﻿package no.doomsday.aronning.engines.verlets.constraints 
{
	import flash.display.Graphics;
	import flash.geom.Point;
	import no.doomsday.aronning.engines.verlets.IRenderable;
	import no.doomsday.aronning.engines.verlets.IUpdatable;
	import no.doomsday.aronning.engines.verlets.constraints.IConstraint;
	import no.doomsday.aronning.engines.verlets.utils.LinkedListNode;
	import no.doomsday.aronning.engines.verlets.Verlet;
	
	/**
	 * ...
	 * @author Andreas Rønning
	 */
	public class PointConstraint extends AbstractConstraint implements IUpdatable, IRenderable, IConstraint
	{
		public var x:Number;
		public var y:Number;
		public function PointConstraint(x:Number = 0,y:Number = 0) 
		{
			this.x = x;
			this.y = y;
		}
		public function update(timeStep:Number = 0):void {
			for (var i:int = constrainedVerlets.length; i--; ) 
			{
				constrainedVerlets[i].x = this.x;
				constrainedVerlets[i].y = this.y;
			}
		}
		public function render(g:Graphics):void {
			g.lineStyle(0, 0x0000FF);
			g.moveTo(x, y-10);
			g.lineTo(x, y+10);
			g.moveTo(x-10, y);
			g.lineTo(x+10, y);
		}
		
	}
	
}